//域名转换
#include <stdio.h>
#include <string.h>

//0xc0a82c05 转 192.168.44.5

int intToString(int num, char *buf, int count) {
	int a = num / 100;
	int b = (num / 10) % 10;
	int c = num % 10;
	if ( a == 0) {
		if ( b != 0) {
			buf[count++] = b + '0';
			buf[count++] = c + '0';
		} else {
			buf[count++] = c + '0';
		}
	} else {
		buf[count++] = a + '0';
		buf[count++] = b + '0';
		buf[count++] = c + '0';
	}
	return count;
}

char *intToChar(unsigned int number) {
	static char buf[20] = {0};
	int count = 0;
	int idx = 24;
	while ( idx >= 0 ) {
		int num = (number >> idx) & 0xff;
		count = intToString(num, buf, count);
		if ( idx != 0) {
			buf[count++] = '.';
		}
		idx -= 8;
	}
	return buf;
}

int main() {
	long long int number = 0xc3131372E37342E3133362E3334;
	char *ret = intToChar( number );
	printf("ret = %s \n", ret);
	return 0;
}
